﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SystemCenterSoa.DtoModel.SystemManager.MyModelDto;
using SystemCenterSoa.IRepository.SystemManager;
using SystemCenterSoa.PoModel.SystemManager.MyModelPo;
using SystemCenterSoa.Repository.CommonLib;

namespace SystemCenterSoa.Repository.SystemManager
{
    public class AttendanceRepository: BaseRepository, IAttendanceRepository
    {
        public AttendanceRepository(SystemCenterDbSoaContext SystemCenterDbSoaContext) : base(SystemCenterDbSoaContext)
        {

        }
        /// <summary>
        /// 考勤月汇总—显示
        /// </summary>
        /// <returns></returns>
        public List<MonthSummaryPo> MonthSummaryPoIndex(string name)
        {
            var shuju = _systemCenterDbSoaContext.MonthSummaryPo.AsQueryable();
            if(!string.IsNullOrWhiteSpace(name))
            {
                shuju = shuju.Where(p => p.ms_meng.Contains(name));
            }
            return shuju.ToList();
        }

        /// <summary>
        /// 考勤月专业组分析
        /// </summary>
        /// <returns></returns>
        public List<ProfessionalPo> ProfessionalPoIndex()
        {
            var shuju = _systemCenterDbSoaContext.ProfessionalPo.AsQueryable();
            return shuju.ToList();
        }
        /// <summary>
        /// 部门加班补助显示
        /// </summary>
        /// <param name="nian"></param>
        /// <param name="yue"></param>
        /// <returns></returns>
        public List<ShowSubsidyDto> showSubsidy()
        {
            var shuju = from A in _systemCenterDbSoaContext.ShowSubsidyPo
                        join B in _systemCenterDbSoaContext.DepartmentPo
                        on A.deptId equals B.deptId
                        select new ShowSubsidyDto()
                        {
                            subsidyId = A.subsidyId,
                            pzName = A.pzName,
                            pMonthlyWages = A.pMonthlyWages,
                            pLeave = A.pLeave,
                            pBeLate = A.pBeLate,
                            pOvertime = A.pOvertime,
                            pCoefficient = A.pCoefficient,
                            pCalculateMoney = A.pCalculateMoney,
                            theQuota = A.theQuota,
                            pState = A.pState,
                            deptId = B.deptId,
                            deptName = B.deptName,
                        };
            return shuju.ToList();
        }
        /// <summary>
        /// 部门经理加班补助显示
        /// </summary>
        /// <param name="nian"></param>
        /// <param name="yue"></param>
        /// <returns></returns>
        public List<ShowSubsidyDto> showJingliSubsidy()
        {
            var shuju = from A in _systemCenterDbSoaContext.ShowSubsidyPo
                        join B in _systemCenterDbSoaContext.DepartmentPo
                        on A.deptId equals B.deptId
                        select new ShowSubsidyDto()
                        {
                            subsidyId = A.subsidyId,
                            pzName = A.pzName,
                            pMonthlyWages = A.pMonthlyWages,
                            pLeave = A.pLeave,
                            pBeLate = A.pBeLate,
                            pOvertime = A.pOvertime,
                            pCoefficient = A.pCoefficient,
                            pCalculateMoney = A.pCalculateMoney,
                            theQuota = A.theQuota,
                            pState = A.pState,
                            deptId = B.deptId,
                            deptName = B.deptName,
                        };
            return shuju.ToList();
        }
    }
}
